<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>

<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>显示订单信息</title>
    <script type="text/javascript">
      function ajaxCancelOrdeno(item) {
	 
		$.ajax({
			type : 'post',
			url : '${ctx}/cancelOrder/ajaxCancelOrder',
			data : 'orderno='+item,
			dataType : 'json',
			success : function(data) {
				$("#message").show();
		        $("#content").html( data.content);
					

			},

			error : function() {

			}
		});
	}
    </script>
 
  </head>
  
  <body>
  <div id="message" class="alert alert-success" style="display: none;">
				<span id="content">${message }</span>
			</div>
   <div>
     	<table id="contentTable"
			class="table table-striped table-bordered table-condensed">
			<thead>
				<tr>
					<th>
						<div class="nav dropdown pull-left">
							
								订单号 
						</div>
					</th>
					<th>
						
								来源店铺 
					</th>
					<th>
						
								收货人
					</th>
					<th>
						
								目的地 
					</th>
					<th>

						
								审核时间 
					</th>
					<th>

						订单状态
					</th>
					<th>
						查询
					</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${object}" var="order">
					<tr>
						<td>
							${order.ordeno}
						</td>
						<td>
							${order.shopna}
						</td>
						<td>
							${order.recena}
						</td>
						<td>
							${order.provna}
						</td>
						<td>
							${order.crtime}
						</td>
						<td>
						  <c:if test="${order.orderStatus eq 'cancel'}">
						     <span class="label label-inverse">取消订单</span>    
						  </c:if>
						   <c:if test="${order.orderStatus eq 'ok'}">
						     <span class="label label-success">正常单</span>    
						  </c:if>
						</td>
						<td>
						<c:if test="${order.orderStatus ne 'cancel' }">
						
						  <a href="#delete_${order.ordeno}" role="button" class="btn btn-danger" data-toggle="modal">取消订单</a>
 
					<div id="delete_${order.ordeno}" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
						<div class="modal-body">
							<h4>确定取消订单${order.ordeno}吗？</h4>
						</div>
						<div class="modal-footer">
							<button class="btn" data-dismiss="modal" aria-hidden="true">返回</button>
							<a href="javascript:ajaxCancelOrdeno('${order.ordeno }')" class="btn btn-danger"> 确定取消</a>
						</div>
					</div>
						</c:if>
							
						      
							
							<a href="#ordersDetailed"
								onclick="getAjaxOrders('${order.id}')" role="button"
								class="btn" data-toggle="modal"> 订单详情 </a>

							<a href="#itemsDetailed"
								onclick="getAjaxItems('${order.id}')" role="button"
								class="btn" data-toggle="modal"> 商品详情 </a>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>

		<div style="display: none; width: 1000" class="modal hide fade"
			tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
			aria-hidden="true" id="ordersDetailed">
			<div class="modal-header">
				<h3 id="myModalLabel">
					订单详细信息
				</h3>
			</div>
			<div class="modal-body">
				<table class="table table-striped table-bordered table-condensed"
					id="modalBodyOrders"></table>
			</div>
			<div class="modal-footer">
				<button class="btn" data-dismiss="modal" aria-hidden="true">
					关闭
				</button>
			</div>
		</div>

		<div style="display: none; width: 1000" class="modal hide fade"
			tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
			aria-hidden="true" id="itemsDetailed">
			<div class="modal-header">
				<h3 id="myModalLabel">
					商品详细信息
				</h3>
			</div>
			<div class="modal-body">
				<table class="table table-striped table-bordered table-condensed"
					id="modalBodyItems"></table>
			</div>
			<div class="modal-footer">
				<button class="btn" data-dismiss="modal" aria-hidden="true">
					关闭
				</button>
			</div>
		</div>
     
   </div>
  </body>
</html>
